********************************************************************************
*							MASTER CLEANING DO FILE
********************************************************************************
/* 
Notes:

Order of do files matters, since some later files call upon datasets created 
in earlier do files.

Before running the code below, make sure to run clean_distances.R in R 
to generate data with area-based distance-to-shooting measure 
that is then saved in raw/distances/processed/ sub-directory.

Set working directory to /cleaning_code directory.
*/

version 17.0
clear all
set more off
cap mkdir ../data
cap mkdir ../data_intermediate
cap mkdir ../temp

// run programs from code folder
do clean_census.do				
do clean_census_voter_supplement.do 
do clean_votecal.do				
do clean_shootings.do 
do create_main.do 
do create_main_extended.do		
do create_main_distance.do	 // Requires you to have run clean_distances.R in R 
do clean_referenda.do	

// Data Quality Check
do create_main_distance_alt.do	
// Note: creates alternative (and simpler) distance-to-shooting measure 
// that generates similar/consistent results to our primary area-based measure

